Skip to content

feat: sms: scheme#454

Open
maxfenton wants to merge 4 commits into
ezyang:masterfrom
maxfenton:mf/374-sms-links
Open

feat: sms: scheme#454
maxfenton wants to merge 4 commits into
ezyang:masterfrom
maxfenton:mf/374-sms-links

Conversation

@maxfenton
Copy link
Copy Markdown

Ref: #374
Ref: https://www.rfc-editor.org/rfc/rfc5724.html

Adds support for sms: scheme URLs with examples:

  • sms:555
  • sms:555?body=HOME (part of the spec)
  • sms:555&body=HOME (commonly used across the web)

@maxfenton maxfenton force-pushed the mf/374-sms-links branch 3 times, most recently from d9c96d8 to e32b1c8 Compare September 22, 2025 16:03
@maxfenton
Copy link
Copy Markdown
Author

Can anyone help with this?

@maxfenton maxfenton changed the title [#375] sms: scheme feat: sms: scheme Nov 24, 2025
maxfenton added 2 commits May 18, 2026 00:58
The previous sanitizeBody approach (strip <>"' then strip script/alert/javascript)
left residual content after multi-pass stripping. For example:
  <script>alert("xss")</script>
  → after step 1: scriptalert(xss)/script
  → after step 2: (xss)/            ← fails test expectation of empty string

Decode URL encoding first to catch encoded payloads, then reject the entire
body value if angle brackets are present (the primary HTML injection vector),
rather than attempting partial character stripping that can be bypassed.

Also re-encode the output so decoded bodies (e.g. Hello%20World) round-trip
correctly through the URL attribute context.

Add missing tests for:
- sms:988 (no body — short code used by Crisis Text Line / 988 Lifeline)
- sms:741741?body=SEIZE (RFC 5724 ?body= input normalised to &body= output)
- sms:741741&body=SEIZE (short code with body round-trip)
…ttributes

URISchemeRegistry::getScheme() can receive null when a URI has no scheme
(relative URIs). PHP 8.5 deprecates null as an array offset — add an
early return for null scheme.

SplObjectStorage::attach(), contains(), detach() are deprecated in PHP 8.5
in favour of offsetSet(), offsetExists(), offsetUnset(). Update
RemoveSpansWithoutAttributes to use the new method names.
@maxfenton
Copy link
Copy Markdown
Author

Back again to try to get this approved. Fixed a bug on my side that I didn't see when the ci PHP 8.5 was failing. Please add sms support to htmlpurifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant